﻿using Newtonsoft.Json;

namespace ZZDingTalkSDK.ZZDingTalkResponse.common
{
    public class ZZDingTalkResponse<T>
    {
        /// <summary>
        /// 响应是否成功
        /// </summary>
        [JsonProperty("success")]
        public bool Success { get; set; }

        /// <summary>
        /// 错误码
        /// </summary>
        public string? ErrorCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string? ErrorMsg { get; set; }

        /// <summary>
        /// 响应内容（非yida表单）
        /// </summary>
        [JsonProperty("content")]
        public T Content { get; set; }

        /// <summary>
        /// 响应内容（yida表单）
        /// </summary>
        [JsonProperty("result")]
        public T Result { get; set; }

        /// <summary>
        /// 请求响应的全部Content内容
        /// </summary>
        public string? ResponseContent { get; set; }
    }

    public class ZZDingTalkResponseContent<T>
    {
        /// <summary>
        /// 响应内容
        /// </summary>
        [JsonProperty("data")]
        public T Data { get; set; }

        /// <summary>
        /// 响应消息
        /// </summary>
        [JsonProperty("responseMessage")]
        public string? ResponseMessage { get; set; }

        /// <summary>
        /// 响应码
        /// </summary>
        [JsonProperty("responseCode")]
        public string? ResponseCode { get; set; }

        /// <summary>
        /// 业务错误码
        /// </summary>
        [JsonProperty("bizErrorCode")]
        public string? BizErrorCode { get; set; }
    }

    public class ZZDingTalkPageResponseContent<T> : ZZDingTalkResponseContent<T>
    {
        /// <summary>
        /// 总页数
        /// </summary>
        [JsonProperty("totalSize")]
        public int TotalSize { get; set; }

        /// <summary>
        /// 当前页数
        /// </summary>
        [JsonProperty("pageSize")]
        public int PageSize { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>

        [JsonProperty("currentPage")]
        public int CurrentPage { get; set; }
    }
}